<?php class Dependencies { 

    /***
     * DB Fields: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $id;

    /***
     * DB Fields: idSource
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $idSource;

    /***
     * DB Fields: tableSource
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $tableSource;

    /***
     * DB Fields: idTarget
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $idTarget;

    /***
     * DB Fields: tableTarget
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $tableTarget;

    /***
     * DB Fields: levelTarget
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $levelTarget;

//--------------- GET METHODS ----------------------------- //
    /***
     * Get value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result id
     **/
    function get_id( ) {
        // returns the value of id
        return $this->id;
    }


    /***
     * Get value for field: idSource
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result idSource
     **/
    function get_idSource( ) {
        // returns the value of idSource
        return $this->idSource;
    }


    /***
     * Get value for field: tableSource
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result tableSource
     **/
    function get_tableSource( ) {
        // returns the value of tableSource
        return $this->tableSource;
    }


    /***
     * Get value for field: idTarget
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result idTarget
     **/
    function get_idTarget( ) {
        // returns the value of idTarget
        return $this->idTarget;
    }


    /***
     * Get value for field: tableTarget
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result tableTarget
     **/
    function get_tableTarget( ) {
        // returns the value of tableTarget
        return $this->tableTarget;
    }


    /***
     * Get value for field: levelTarget
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result levelTarget
     **/
    function get_levelTarget( ) {
        // returns the value of levelTarget
        return $this->levelTarget;
    }


//--------------- SET METHODS ----------------------------- //
    /***
     * Set value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function set_id( $id ) {
        // sets the value of id
        $this->id = $id;
    }

    /***
     * Set value for field: idSource
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param idSource
     * @result void
     **/
    function set_idSource( $idSource ) {
        // sets the value of idSource
        $this->idSource = $idSource;
    }

    /***
     * Set value for field: tableSource
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param tableSource
     * @result void
     **/
    function set_tableSource( $tableSource ) {
        // sets the value of tableSource
        $this->tableSource = $tableSource;
    }

    /***
     * Set value for field: idTarget
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param idTarget
     * @result void
     **/
    function set_idTarget( $idTarget ) {
        // sets the value of idTarget
        $this->idTarget = $idTarget;
    }

    /***
     * Set value for field: tableTarget
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param tableTarget
     * @result void
     **/
    function set_tableTarget( $tableTarget ) {
        // sets the value of tableTarget
        $this->tableTarget = $tableTarget;
    }

    /***
     * Set value for field: levelTarget
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param levelTarget
     * @result void
     **/
    function set_levelTarget( $levelTarget ) {
        // sets the value of levelTarget
        $this->levelTarget = $levelTarget;
    }

//--------------- CRUD METHODS ----------------------------- //
    /***
     * Create a new Record: dependencies
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param idSource
     * @param tableSource
     * @param idTarget
     * @param tableTarget
     * @param levelTarget
     * @result void
     **/
    function createnew_dependencies( $id, $idSource, $tableSource, $idTarget, $tableTarget, $levelTarget ) {

        // items to be inserted in the database 
        $_obj = array($id,
                      $idSource,
                      $tableSource,
                      $idTarget,
                      $tableTarget,
                      $levelTarget); 

        // database object connection
        $dbConn = $GLOBALS['dbConn'];

        // perform insert in the database
        $dbConn->insert("dependencies", $_obj);
    }

    /***
     * Retrived an existing record: dependencies
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result new Dependencies
     **/
    function get_dependencies( $id ) {

        // retrive the data
        $dbConn = $GLOBALS['dbConn'];

        // retrieved value in the database
        $_resultSet = $dbConn->doQuery("SELECT * FROM dependencies WHERE id = '$id'");

        $__dependenciesObj = new dependencies();
        // return the retrived from the database

        // create a new object
        $__obj = new Dependencies();
        $__obj->set_id($_resultSet[0]['id']);
        $__obj->set_idSource($_resultSet[0]['idSource']);
        $__obj->set_tableSource($_resultSet[0]['tableSource']);
        $__obj->set_idTarget($_resultSet[0]['idTarget']);
        $__obj->set_tableTarget($_resultSet[0]['tableTarget']);
        $__obj->set_levelTarget($_resultSet[0]['levelTarget']);


        return $__obj;
    }

    /***
     * Update an existing record: dependencies
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param itemsToBeUpdated = array()
     * @result void
     **/
    function update_dependencies( $id, $itemsToBeUpdated = array() ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs update in the database
         foreach($itemsToBeUpdated as $_fName => $_fVal) { 
               $dbConn->addValuePair($_fName, $_fVal);
         }

         // perform update operation
         $dbConn->update("dependencies", "id = '$id'");
    }

    /***
     * Delete an existing record: dependencies
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function delete_dependencies( $id ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs deletion of data
         $dbConn->delete("dependencies", "id = '$id'");
    }

    /***
     * Retrived list of objects base on a given parameters: dependencies
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param conditionalStatement = ''
     * @result collection of objects: Dependencies
     **/
    function list_dependencies( $conditionalStatement = '' ) {

         $dbConn = $GLOBALS['dbConn'];
         // check if there is a given parameter list
         if(!empty($conditionalStatement)) { 
              $sqlStatement = "SELECT * FROM dependencies WHERE $conditionalStatement"; 
         } else { 
              $sqlStatement = "SELECT * FROM dependencies";
         }

         // retrieve the values base on the query result
         $__resObj = $dbConn->doQuery($sqlStatement);

         $__collectionOfObjects = array();
         foreach($__resObj as $__rs) { 
            $__newObj = new Dependencies();

            $__newObj->set_id($__rs['id']);
            $__newObj->set_idSource($__rs['idSource']);
            $__newObj->set_tableSource($__rs['tableSource']);
            $__newObj->set_idTarget($__rs['idTarget']);
            $__newObj->set_tableTarget($__rs['tableTarget']);
            $__newObj->set_levelTarget($__rs['levelTarget']);

            // add object to collection 
            array_push($__collectionOfObjects, $__newObj);
         }

         // return collection of objects
         return $__collectionOfObjects;
    }

} ?>